package com.jhhc.StormSurgeForecast.StormSurge.ServiceImpl;

import com.jhhc.StormSurgeForecast.StormSurge.Pojo.FBC.BDMS_FBC_TIDE_HL_F;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;

/**
 * (BdmsFbcTideHlF)表服务实现类
 *
 * @author makejava
 * @since 2023-03-28 17:57:59
 */
@Service("bdmsFbcTideHlFService")
public class BDMS_FBC_TIDE_HL_FServiceImpl implements com.jhhc.StormSurgeForecast.StormSurge.Service.BDMS_FBC_TIDE_HL_FService {
    @Resource
    private com.jhhc.StormSurgeForecast.StormSurge.Dao.BDMS_FBC_TIDE_HL_FMapper bdmsFbcTideHlFDao;

    /**
     * 通过ID查询单条数据
     *
     * @param stcd 主键
     * @return 实例对象
     */
    @Override
    public BDMS_FBC_TIDE_HL_F queryById(String stcd) {
        return this.bdmsFbcTideHlFDao.queryById(stcd);
    }

    /**
     * 分页查询
     *
     * @param BDMSFBCTIDEHLF 筛选条件
     * @param pageRequest    分页对象
     * @return 查询结果
     */
    @Override
    public Page<BDMS_FBC_TIDE_HL_F> queryByPage(BDMS_FBC_TIDE_HL_F BDMSFBCTIDEHLF, PageRequest pageRequest) {
        long total = this.bdmsFbcTideHlFDao.count(BDMSFBCTIDEHLF);
        return new PageImpl<>(this.bdmsFbcTideHlFDao.queryAllByLimit(BDMSFBCTIDEHLF, pageRequest), pageRequest, total);
    }

    /**
     * 新增数据
     *
     * @param BDMSFBCTIDEHLF 实例对象
     * @return 实例对象
     */
    @Override
    public BDMS_FBC_TIDE_HL_F insert(BDMS_FBC_TIDE_HL_F BDMSFBCTIDEHLF) {
        this.bdmsFbcTideHlFDao.insert(BDMSFBCTIDEHLF);
        return BDMSFBCTIDEHLF;
    }

    /**
     * 修改数据
     *
     * @param BDMSFBCTIDEHLF 实例对象
     * @return 实例对象
     */
    @Override
    public BDMS_FBC_TIDE_HL_F update(BDMS_FBC_TIDE_HL_F BDMSFBCTIDEHLF) {
        this.bdmsFbcTideHlFDao.update(BDMSFBCTIDEHLF);
        return this.queryById(BDMSFBCTIDEHLF.getStcd());
    }

    /**
     * 通过主键删除数据
     *
     * @param stcd 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String stcd) {
        return this.bdmsFbcTideHlFDao.deleteById(stcd) > 0;
    }
}
